import { HotSellInfo } from "./HotSellInfo";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { Language } from "../../../../extend/language/Language";
import { SearchConditionData } from "./SearchConditionData";
import { EMarketRecordType } from "../../../../Message/Game/EMarketRecordType";
import { MsgManager } from "../../manager/MsgManager";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
//class HotSellTextItem
    
    export  class HotSellTextItem /* flash.display.Sprite */
    {
        constructor(arg1: HotSellInfo)
        {
            
            mouseChildren = false;
            useHandCursor = true;
            buttonMode = true;
            this._hotSellInfo = arg1;
            this.init(arg1);
            addEventListener(flash.events.MouseEvent.CLICK, this.onMouseClickHandler);
            return;
        }

        /* internal  */init(arg1: HotSellInfo): void
        {
            var loc1=ObjCreate.createBg(0, 0, 90, 23, this, ImagesConst.FightingStrgBg);
            this._textField = ObjCreate.createTextField("", 0, 2, 90, 20, this, new GTextFormat("", 12, 16776960, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._textField.text = arg1.name;
            return;
        }

        /* internal  */onMouseClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._hotSellInfo.name == Language.getString(31115) && SearchConditionData.recordType == EMarketRecordType._EMarketRecordTypeSeekBuy) 
            {
                MsgManager.showRollTipsMsg(Language.getString(31116));
            }
            else 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.MarketGetHotSellGoods, this._hotSellInfo));
            }
            return;
        }

        /* internal */ /* var */_textField: Object /* flash.text.TextField */;

        /* internal */ /* var */_hotSellInfo: HotSellInfo;
    }
